//
//  LandingViewController.m
//  ieGou
//
//  Created by Mario on 15/1/28.
//  Copyright (c) 2015年 chaox. All rights reserved.
//  登陆页面

#import "LandingViewController.h"
#import "MineViewController.h"
#import "LoginViewController.h"

@interface LandingViewController () <UITextFieldDelegate>

@property (nonatomic, retain)UITextField *textField1;
@property (nonatomic, retain)UITextField *textField2;

@property (nonatomic, retain)UILabel *label01;
@property (nonatomic, retain)UILabel *label02;

@end

@implementation LandingViewController

- (void)dealloc
{
    [_textField1 release];
    [_textField2 release];
    [_label01 release];
    [_label02 release];
    [super dealloc];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    self.title = @"登陆";
    [self.navigationController.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    self.navigationController.navigationBar.barTintColor = [UIColor colorWithRed:95/255.0 green:207/255.0 blue:173/255.0 alpha:1];
    self.navigationItem.leftBarButtonItem = [[[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"mjiantou"] style:UIBarButtonItemStyleDone target:self action:@selector(returnAction:)]autorelease];
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.textField1 = [[UITextField alloc] initWithFrame:CGRectMake(40, 100, 295, 44)];
    self.textField1.borderStyle = UITextBorderStyleRoundedRect;
    // 不可编辑
    self.textField1.enabled = NO;
    [self.view addSubview:_textField1];
    
    
    self.textField2 = [[UITextField alloc] initWithFrame:CGRectMake(40, 160, 295, 44)];
    self.textField2.borderStyle = UITextBorderStyleRoundedRect;
    self.textField2.enabled = NO;
    [self.view addSubview:_textField2];
    
    
    
    UIImageView *imageView01 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 7, 30, 30)];
    imageView01.image = [UIImage imageNamed:@"4.png"];
    [_textField1 addSubview:imageView01];
    [imageView01 release];
    
    UIImageView *imageView02 = [[UIImageView alloc] initWithFrame:CGRectMake(10, 7, 30, 30)];
    imageView02.image = [UIImage imageNamed:@"5.png"];
    [_textField2 addSubview:imageView02];
    [imageView02 release];
    
    UITextField *textField03 = [[UITextField alloc] initWithFrame:CGRectMake(90, 100, 245, 44)];
    textField03.placeholder = @"请输入用户名";
    textField03.tag = 10;
    textField03.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:textField03];
    [textField03 release];
    
    UITextField *textField04 = [[UITextField alloc] initWithFrame:CGRectMake(90, 160, 245, 44)];
    textField04.placeholder = @"请输入密码";
    textField04.tag = 20;
    textField04.keyboardType = UIKeyboardTypeASCIICapable;
    textField04.returnKeyType = UIReturnKeyGo;
    textField04.clearButtonMode = UITextFieldViewModeAlways;
    [self.view addSubview:textField04];
    [textField04 release];
    
    
    UIView *view3 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 375, 64)];
    view3.backgroundColor = [UIColor lightGrayColor];
    [self.view addSubview:view3];
    
    
    UIButton *button4 = [UIButton buttonWithType:UIButtonTypeSystem];
    [button4 setTitle:@"忘记了密码?" forState:UIControlStateNormal];
    [button4 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    button4.frame = CGRectMake(40, 260, 130, 70);
    [button4 addTarget:self action:@selector(buttonClicked3:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button4];
    
    UIButton *registButton = [UIButton buttonWithType:UIButtonTypeSystem];
    [registButton setTitle:@"注册一个" forState:UIControlStateNormal];
    [registButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    registButton.frame = CGRectMake(220, 260, 130, 70);
    [registButton addTarget:self action:@selector(registAction:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:registButton];
    
    
    UIButton *button05 = [UIButton buttonWithType:UIButtonTypeSystem];
    [button05 setTitle:@"登陆" forState:UIControlStateNormal];
    [button05 setTitleColor:[UIColor lightGrayColor] forState:UIControlStateNormal];
    button05.frame = CGRectMake(40, 220, 295, 44);
    button05.backgroundColor = [UIColor colorWithRed:241/255.0 green:241/255.0 blue:241/255.0 alpha:1];
    [button05 addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button05];
    
}

- (void)returnAction:(UIBarButtonItem *)sender
{
//    [self.navigationController popToRootViewControllerAnimated:YES];
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

- (void)barButtonAction:(UIBarButtonItem *)barButton
{
    
}

- (void)buttonClicked:(UIButton *)button
{
    
}

- (void)registAction:(UIButton *)sender
{
    
}

- (void)buttonClicked1:(UIButton *)button
{
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];
}

- (void)buttonClicked2:(UIButton *)button
{
    LoginViewController *loginVC = [[LoginViewController alloc] init];
    loginVC.modalPresentationStyle = UIModalTransitionStyleCoverVertical;
    //    [self.navigationController pushViewController:landingVC animated:YES];
    [self presentViewController:loginVC animated:YES completion:^{
        
    }];

//    LoginViewController *loginVC = [[LoginViewController alloc] init];
//    loginVC.title = @"注册账号";
//    [self.navigationController pushViewController:loginVC animated:YES];
}

- (void)buttonClicked3:(UIButton *)button
{
    
}

- (void)buttonClicked4:(UIButton *)button
{
    
}

- (void)buttonClicked5:(UIButton *)button
{
//    if (self.flag == YES) {
//        UIImageView *imageView03 = [[UIImageView alloc] initWithFrame:CGRectMake(45, 277, 15, 15)];
//        imageView03.image = [UIImage imageNamed:@"7.png"];
//        [self.view addSubview:imageView03];
//    }else {
//        self.imageView04 = [[UIImageView alloc] initWithFrame:CGRectMake(45, 277, 15, 15)];
//    _imageView04.image = [UIImage imageNamed:@"6.png"];
//    [self.view addSubview:_imageView04];
//    }
//    
//    self.flag = !self.flag;
}


- (BOOL)textFieldShouldReturn:(UITextField *)textField
{
    [textField resignFirstResponder];
    return YES;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
